<template>
    <view class="main-content">
		<index-header :statusBarHeight="statusBarHeight"></index-header>
        <view class="content" :style="{'padding-top': statusBarHeightS +'px'}">
			<view class="banner_content">
			   <swiper class="swiper" indicator-color="#FFFFFF" indicator-active-color="#165E8E" 
			   autoplay="true" @change="changeBanner">
					<swiper-item v-for="(item,index) in bannerList" :key="index">
						<image class="swiper-item" :src="item.url"></image>
					</swiper-item>
			   </swiper>
			   <view class="dots_list">
					<text v-for="(item,eindex) in bannerList" :key="eindex" :class="{'dot_point':true,'dot_selected':eindex == bannerIndex?true:false}"></text>
			   </view>
		   </view>
		   <view class="nav_server">
			   <view class="nav_s" @click="jump(1)">
				   <image src="../../static/img/home/1.png"></image>
				   <text style="font-size: 14upx">奖励</text>
			   </view>
			   <view class="nav_s" @click="jump(2)">
				   <image src="../../static/img/home/2.png"></image>
				   <text style="font-size: 14upx">遥感</text>
			   </view>
			   <view class="nav_s" @click="jump(3)">
				   <image src="../../static/img/home/3.png"></image>
				   <text style="font-size: 14upx">地图</text>
			   </view>
			   <view class="nav_s" @click="jump(4)">
				   <image src="../../static/img/home/4.png"></image>
				   <text style="font-size: 14upx">申请</text>
			   </view>
		   </view>
		   
		   <view class="notice_content">
			   <image class="label_img" src="../../static/img/label.png" mode=""></image>
			   <swiper class="swiper" indicator-color="#FFFFFF" indicator-active-color="#165E8E" 
			   autoplay="true" @change="changeBanner1" @click="jumpAct()">
					<swiper-item class="swiper-item" v-for="(item,indexs) in bannerList1" :key="indexs" :style="{'background':'url(' + item.url +') center no-repeat','background-size':'cover'}">
						<text class="title">【通知公告】</text>
						<text class="second_title">中国测绘学会关于举办“测绘大讲堂” 第二季活动的通知</text>
						<view class="html_content">
							<text>本会理事、分会及专业（工作）委员会、团体会员单位，各省、自治区、直辖市及计划单列市测绘（地理信息）学会，其他相关单位：</text>
							<text>为关注国际测量发展动向、传承地图文化、推进测绘教育和学科发展，结合疫情防控需要，中国测绘学会将于3月4日-4月15日期间，
							举办“测绘大讲堂”第二季系列活动，开展在线交流学习。请各单位积极组织报名参会。现将有关事项通知如下：</text>
							<text>一、组织机构</text>
							<text>主办单位：中国测绘学会</text>
							<text>协办单位：全国各省、自治区、直辖市及计划单列市测绘（地理信息）学会</text>
							<text>媒体支持单位：科创中国、科技工作者之家、《中国测绘》、51GIS学院、中国知网、天乐测绘网、泰伯网、慧天地</text>
							<text>技术支持单位：星月测绘、七维视觉、易智瑞信息技术有限公司</text>
						</view>
					</swiper-item>
			   </swiper>
			   <view class="dots_list">
					<text v-for="(item,eindex) in bannerList1" :key="eindex" :class="{'dot_point':true,'dot_selected':eindex == noticeIndex?true:false}"></text>
			   </view>
		   </view>
		   
		   <view class="info_list" v-for="(items,index) in infoList" @tap="jumpNews()" :key="index">
			   <view class="info_title">
				   <image class="info_logo" :src="items.logo"></image>
				   <text class="title">{{items.title}}</text>
			   </view>
			   <view class="info_list_list" v-for="(item,eindex) in items.list" :key="eindex">
				   <text class="point"></text>
				   <text class="desc">{{item.desc}}</text>
			   </view>
		   </view>
			
			<view class="secend_nav_list">
				<view class="list_1">
					<view class="item_1" @tap="changeNavList" data-index="1">地方动态<text v-if="navIndex == 1" class="iconfont icon_triggle"></text></view>
					<view class="item_1" @tap="changeNavList" data-index="2">分支机构<text v-if="navIndex == 2" class="iconfont icon_triggle"></text></view>
				</view>
				<view class="list_1">
					<view class="item_1" @tap="changeNavList" data-index="3">团体会员<text v-if="navIndex == 3" class="iconfont icon_triggle"></text></view>
					<view class="item_1" @tap="changeNavList" data-index="4">媒体声音<text v-if="navIndex == 4" class="iconfont icon_triggle"></text></view>
				</view>
			</view>
			
			<view class="canler" v-for="(item, index) in canlerList" :key="index">
				<view class="canler_circle">
					<text class="canler_year">{{item.year}}</text>
					<text class="canler_line"></text>
					<text class="canler_month">{{item.month}}月</text>
				</view>
				<view class="canler_content">
					<text class="canler_time">时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间：{{item.time}}</text>
					<text class="canler_time">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;点：{{item.address}}</text>
					<text class="canler_time">主办单位：{{item.site}}</text>
				</view>
				<text class="iconfont icon_right"></text>
			</view>
			
			<view class="image_list">
				<image v-for="(items,indexs) in bannerList2" @click="jumpUrl(items.url)"  :src="items.pic"></image>
			</view>
			
        </view>
		<bottom :topState="topState" @goTop="goTop"></bottom>
    </view>
</template>

<script>
    import {
        mapState,
        mapMutations
    } from 'vuex';
	
    export default {
        data() {
            return {
				bannerList:[{
					url:'../../static/img/home/banner.png'
				},{
					url:'../../static/img/home/banner2.png'
				},{
					url:'../../static/img/home/banner3.png'
				},{
					url:'../../static/img/home/banner4.png'
				}],
				bannerList2:[{
					pic:'../../static/img/home/banner.png',url:'/pages/activity/Auditorium'
				},{
					pic:'../../static/img/home/banner2.png',url:'/pages/search/reward'
				},{
					pic:'../../static/img/home/banner3.png',url:'/pages/home/gistopic'
				},{
					pic:'../../static/img/home/banner4.png',url:'/pages/home/lookback'
				}],
				bannerList1:[{
					url:'../../static/img/notice_banner.png',
					html:'<div>222222</div>'
				},{
					url:'../../static/img/notice_banner.png'
				},{
					url:'../../static/img/notice_banner.png'
				},{
					url:'../../static/img/notice_banner.png'
				},{
					url:'../../static/img/notice_banner.png'
				}],
				
				infoList:[{
					logo:'../../static/img/home/news.png',
					title:'时政要闻',
					list:[{
						desc:'全国脱贫攻坚总结表彰大会隆重举行 习近平向全...'
					},{
						desc:'习近平庄严宣告：我国脱贫攻坚战取得了全面胜利'
					},{
						desc:'历史性的跨越 新奋斗的起点——习近平总书记关...'
					}]
				},{
					logo:'../../static/img/home/10.png',
					title:'学会动态',
					list:[{
						desc:'全国脱贫攻坚总结表彰大会隆重举行 习近平向全...'
					},{
						desc:'习近平庄严宣告：我国脱贫攻坚战取得了全面胜利'
					},{
						desc:'历史性的跨越 新奋斗的起点——习近平总书记关...'
					}]
				},{
					logo:'../../static/img/home/9.png',
					title:'通知公告',
					list:[{
						desc:'全国脱贫攻坚总结表彰大会隆重举行 习近平向全...'
					},{
						desc:'习近平庄严宣告：我国脱贫攻坚战取得了全面胜利'
					},{
						desc:'历史性的跨越 新奋斗的起点——习近平总书记关...'
					}]
				}],
				
				canlerList:[{
					year:'03',
					month:'02',
					time:'19:30:00',
					address:'请扫描二维码观看',
					site:'航天宏图'
				},{
					year:'03',
					month:'02',
					time:'19:30:00',
					address:'请扫描二维码观看',
					site:'航天宏图'
				}],
				bannerIndex:0,
				noticeIndex:0,
				topState:false,
				navIndex:1,
				statusBarHeight:'',
				statusBarHeightS:''
            };
        },
		
        onPageScroll() {
            let view = uni.createSelectorQuery().in(this).select(".np-home-index");
            view.boundingClientRect(data => {
                if (data.top <= 0) {
                    this.txtYpe = 0
                }
                if (data.top > 0) {
                    this.txtYpe = 1
                }
            }).exec();
        },

        onLoad() {
           
        },
        onShow(e) {
            // #ifdef MP-WEIXIN || APP-PLUS || APP-PLUS-NVUE
			   var sysinfo = uni.getSystemInfoSync();
			   this.statusBarHeight = sysinfo.statusBarHeight + 44;
			   this.statusBarHeightS = sysinfo.statusBarHeight + 88;
			// #endif
			// #ifdef H5
			   var sysinfo = uni.getSystemInfoSync();
			   this.statusBarHeight = '0';
			   this.statusBarHeightS = '54';
			// #endif
        },
        onShareAppMessage() {
           
            return {
                imageUrl:"",
                title:'首页',
                path:'/pages/home/home'
            }
        },
		onPageScroll(e){ //根据距离顶部距离是否显示回到顶部按钮
		    if(e.scrollTop>600){ //当距离大于600时显示回到顶部按钮
		        this.topState = true
		    }else{ //当距离小于600时显示回到顶部按钮
		        this.topState = false
		    }
		},
		
        computed: {
           
        },
        methods: {
			
			changeBanner(e) {
				this.bannerIndex = e.detail.current
			},
			jumpNews(){
					uni.navigateTo({
						url: '/pages/activity/news'
					})
			},
			jumpUrl(url){
					uni.navigateTo({
						url: url
					})
			},
			jumpAct(){
				uni.navigateTo({
					url: '/pages/activity/all'
				})
			},
			// H5平台使用 window.open；小程序平台使用web-view组件（url需在小程序的联网白名单中）
			jump(id) {
				let url=''
				if(id==1){
					 url = 'http://fw.csgpc.org/Csgpc/Login.aspx'
				}else if(id==2){
					url = 'http://sasclouds.com/chinese/statistics/coverage-statics';
				}else if(id==3){
				   uni.navigateTo({
				   	url: '/pages/home/map'
				   })
				   return;
				}else if(id==4){
					uni.navigateTo({
						url: '/pages/home/pteam'
					})
					return;
				}
				
				// #ifdef H5
					window.open(url)
				// #endif
				// #ifdef MP-WEIXIN
					let toUrl = '/pages/service/commonWebview?webTitle=1&webUrl=' + url
					uni.navigateTo({
						url: url
					})
				// #endif
			},
			changeBanner1(e) {
				this.noticeIndex = e.detail.current
			},
			
			goTop(){
				uni.pageScrollTo({ 
		　　　　　　scrollTop: 0, 
					duration: 300 
		　　　　}); 
			},
			
			changeNavList(e){
				this.navIndex = e.target.dataset.index
			}
        }
    }
</script>

<style lang="scss">
    .content {
        width: 750upx;
        height: auto;
        padding-top: 108upx;
		min-height: calc(100% - 631upx);
		
		.banner_content {
			
			// #ifdef MP-WEIXIN || APP-PLUS || APP-PLUS-NVUE
			  margin-top: 20upx;
			// #endif
			position: relative;
			
			.swiper {
				.swiper-item {
					width: 100%;
					height: 100%;
				}
			}
			
			.dots_list {
				position: absolute;
				right: 30upx;
				bottom: 16upx;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				.dot_point {
					margin-left: 10upx;
					width: 12upx;
					height: 12upx;
					border-radius: 50%;
					background: #FFFFFF;
					
					&.dot_selected {
						border-radius: 50%;
						background: #165E8E; 
					}
				}
			}
		}
		
		.nav_server {
			width: 646upx;
			height: 163upx;
			margin: 33upx 44rpx 0 44rpx;
			background: #FFFFFF;
			box-shadow: 0 3upx 6upx rgba(0, 0, 0, 0.16);
			opacity: 1;
			border-radius: 24upx;
			
			display: flex;
			flex-direction: row;
			justify-content: space-around;
			align-items: center;
			
			.nav_s {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				height: 100%;
				
				image {
					width: 71upx;
					height: 71upx;
					margin-bottom: 8upx;
				}
				
				text {
					display: block;
					font-size: 6upx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #165E8E;
					opacity: 1;
				}
			}
		}
    
		.notice_content {
			margin-top: 52rpx;
			margin-bottom: 12upx;
			position: relative;
			width: 100%;
			height: 918upx;
			
			image {
				position: absolute;
				top: -27upx;
				left: 31upx;
				width: 81upx;
				height: 149upx;
				z-index: 100;
			}
			
			.swiper {
				height: 100%;
				.swiper-item {
					width: 100%;
					height: 100%;
					display: flex;
					flex-direction: column;
					
					.title { 
						margin-top: 12upx;
						margin-left: 123upx;
						font-size: 28upx;
						font-family: PingFang SC;
						font-weight: 800;
						line-height: 40upx;
						color: #373737;
						opacity: 1;
					}
					
					.second_title {
						margin-left: 140upx;
						margin-top: 19upx;
						font-size: 24upx;
						font-family: PingFang SC;
						font-weight: 800;
						line-height: 33upx;
						color: #373737;
						opacity: 1;
					}
					
					.html_content {
						position: relative;
						margin: 0 63upx 72upx;
						display: flex;
						flex-direction: column;
						
						text {
							font-size: 24upx;
							font-family: PingFang SC;
							font-weight: 400;
							line-height: 30upx;
							color: #000000;
							opacity: 1;
							margin-top: 37upx;
						}
					}
				}
			}
			
			.dots_list {
				position: absolute;
				right: 51upx;
				bottom: 28upx;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				.dot_point {
					margin-left: 10upx;
					width: 12upx;
					height: 12upx;
					border-radius: 50%;
					background: #D9D9D9;
					
					&.dot_selected {
						border-radius: 50%;
						background: #165E8E; 
					}
				}
			}
		}
	
		.info_list {
			margin: 34upx auto 0 auto;
			height: 272upx;
			background: url(../../static/img/home/组88.png) center no-repeat;
			background-size: cover;
			opacity: 1;
			
			.info_title {
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				
				.info_logo {
					margin-left: 32upx;
					width: 35upx;
					height: 40upx;
				}
				
				.title {
					margin-left: 17upx;
					font-size: 24upx;
					font-family: PingFang SC;
					font-weight: 800;
					line-height: 45upx;
					color: #000000;
					opacity: 1;
				}
			}
		
			.info_list_list {
				margin: 20upx 56upx 0 32upx;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				.point {
					width: 2upx;
					height: 2upx;
					border-radius: 50%;
					background-color: #000;
					margin-right: 8upx;
				}
				
				.desc {
					line-clamp: 1;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
					height: 40upx;
					font-size: 24upx;
					font-family: PingFang SC;
					font-weight: 500;
					line-height: 45upx;
					color: #000000;
					opacity: 1;
				}
			}
		}
	
		.secend_nav_list {
			display: flex;
			flex-direction: column;
			align-items: center;
			margin: 62upx 30upx 59upx;
			
			.list_1 {
				width: 100%;
				height: 106upx;
				background: #165E8E;
				display: flex;
				flex-direction: row;
				align-items: center;
				opacity: 1;
				&:first-child {
					margin-bottom: 20upx;
				}
				.item_1 {
					width: 50%;
					height: 70upx;
					font-size: 36upx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					opacity: 1;
					border-left: 1upx solid #FFF;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;
					position: relative;
					
					.icon_triggle {
						position: absolute;
						font-size: 36upx;
						bottom: -40upx;
						left: 50%;
						margin-left: -18upx;
						color: #FFFFFF;
					}
					
					&:first-child {
						border-left: 0;
					}
				}
			}
		}
	
		.canler {
			margin: 108upx 30upx 0 30upx;
			height: 258upx;
			position: relative;
			border: 1upx solid #DDDDDD;
			
			.canler_circle {
				width: 138upx;
				height: 138upx;
				background: #FFFFFF;
				border: 1upx solid #DDDDDD;
				border-radius: 50%;
				opacity: 1;
				position: absolute;
				top: -69upx;
				left: 50%;
				margin-left: -69upx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				
				.canler_year {
					font-size: 33upx;
					font-family: PingFang SC;
					font-weight: 800;
					line-height: 46upx;
					color: #165E8E;
					opacity: 1;
				}
				
				.canler_line {
					margin: 8upx 0;
					width: 76upx;
					height: 1upx;
					background-color: #165E8E;
					opacity: 1;
				}
				
				.canler_month {
					font-size: 26upx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 37upx;
					color: #165E8E;
					opacity: 1;
				}
			}
			
			.canler_content {
				display: flex;
				flex-direction: column;
				padding-left: 40upx;
				margin-top: 89upx;
				
				.canler_time {
					font-size: 27Upx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 42upx;
					color: #000000;
					opacity: 1;
				}
			}
			
			.icon_right {
				font-size: 47upx;
				color: #165E8E;
				opacity: 1;
				position: absolute;
				right: 33upx;
				bottom: 26upx;
			}
		}
		
		.image_list {
			width: 540upx;
			margin:0 auto;
			margin-bottom: 24upx;
			image {
				padding: 0;
				margin-top: 30upx;
				width: 540upx;
				height: 320upx;
				
				&:first-child {
					margin-top: 44upx;
				}
			}
		}
	}
</style>
